<?php
declare (strict_types = 1);

namespace app\controller;

use app\model\Project1s;
use think\facade\Db;
use think\facade\Session;
use think\Request;
use think\captcha\facade\Captcha;

class Project1
{
    public function pro(Request $request){


        Session::set("a","aaa");
        echo Session::get('a');

        return view('./pro');
    }
    public function pro1(){
        $code = $_POST['code'];
        if( !captcha_check($code ))
        {
            echo '失败';
        }else{
            echo '成功';
        }
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|\think\response\View
     * 顶部，左边，右边，三视图层
     */
    public function getAll(){
        return view('index0');
    }
    public function getTop(){
        return view('top_index');
    }
    public function getRight(){
        return view('right_index');
    }
//    public function show(){
//        $data = Project1s::getAll();
//        return view('project1',['data'=>$data]);
//    }
    public function getshow(){
        $db = Db::table("admin_power")->select();
        $db_s = new Project1s();
        $db_ss = $db_s->getList($db,0);
        var_dump($db_ss);
        //return view('project1',['data'=>$db_ss]);
    }
    public function show(Request $request){
        if($request['id']){
            $id = $request['id'];
        }else{
            $id = 1;
        }
        $pros = new Project1s();
        $data = $pros->getAll($id);
        return view('left_index',['data'=>$data]);
    }
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
        //
    }

    /**
     * 显示创建资源表单页.
     *
     * @return \think\Response
     */
    public function create()
    {
        //
    }

    /**
     * 保存新建的资源
     *
     * @param  \think\Request  $request
     * @return \think\Response
     */
    public function save(Request $request)
    {
        //
    }

    /**
     * 显示指定的资源
     *
     * @param  int  $id
     * @return \think\Response
     */
    public function read($id)
    {
        //
    }

    /**
     * 显示编辑资源表单页.
     *
     * @param  int  $id
     * @return \think\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * 保存更新的资源
     *
     * @param  \think\Request  $request
     * @param  int  $id
     * @return \think\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * 删除指定资源
     *
     * @param  int  $id
     * @return \think\Response
     */
    public function delete($id)
    {
        //
    }
}
